﻿using System.Linq;
using System.Diagnostics.Contracts;
using System.Collections.Generic;
using System;
using ProjectBase.Core;

namespace $safeprojectname$.Restrictions
{
    public abstract class FilterRestrictionHandler<TFilter> : IFilterRestrictionHandler
        where TFilter : class, IFilter
    {
        public virtual Type FilterType { get { return typeof(TFilter); } }

        public virtual void Handle(IFilter filter)
        {
            var f = filter as TFilter;
            if (f.IsNull())
            {
                return;
            }
            Handle(f);
        }

        protected abstract void Handle(TFilter filter);
    }
}